<HTML><HEAD><TITLE>set_timer(+Timer, +Interval)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Obsolete</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>set_timer(+Timer, +Interval)</H1>
Start (or stop) the specified Timer to send signals in intervals of
Interval seconds.


<DL>
<DT><EM>Timer</EM></DT>
<DD>One of the atoms real, virtual or profile.
</DD>
<DT><EM>Interval</EM></DT>
<DD>Number (integer or float)
</DD>
</DL>
<H3>This built-in predicate is obsolete!</H3>
<H2>Description</H2>
   Used to initialise one of the 3 operating system's interval timers.
   After a call to this predicate, the corresponding timer will start
   sending signals to the ECLiPSe process every Interval seconds.  Every
   call will change the previous interval of the specified timer.  A timer
   is switched off by setting its Interval to 0.

<P>
<PRE>
                             -----------------
                             |Timer   |Signal |
                             -----------------
                             |real    |alrm   |
                             |virtual |vtalrm |
                             |profile |prof   |
                             -----------------
</PRE>

<H3>Modes and Determinism</H3><UL>
<LI>set_timer(+, +) is det
</UL>
<H3>Exceptions</H3>
<DL>
<DT><EM>(4) instantiation fault </EM>
<DD>Timer orInterval is not instantiated.
<DT><EM>(5) type error </EM>
<DD>Timer is not an atom.
<DT><EM>(5) type error </EM>
<DD>Interval is not integer or float.
<DT><EM>(6) out of range </EM>
<DD>Timer is an atom not naming a timer.
<DT><EM>(170) system interface error </EM>
<DD>Interval is an out of range timer interval.
</DL>
<H2>Examples</H2>
<PRE>
[eclipse]: [user].
 handler(N) :-
        getval(count, Count),
        writeln(signal(N)-Count),
        ( Count &gt; 0 -&gt;
                decval(count)
        ;
                set_timer(real, 0)      % switch off the timer
        ).

 :- set_interrupt_handler(alrm, handler/1).
 user       compiled traceable 372 bytes in 0.00 seconds

yes.
[eclipse]: setval(count, 4), set_timer(real, 0.5).

yes.
[eclipse]: signal(14) - 4
signal(14) - 3
signal(14) - 2
signal(14) - 1
signal(14) - 0



</PRE>
<H2>See Also</H2>
<A HREF="../../kernel/event/event_after-2.html">event_after / 2</A>, <A HREF="../../kernel/event/event_after_every-2.html">event_after_every / 2</A>, <A HREF="../../kernel/opsys/alarm-1.html">alarm / 1</A>, <A HREF="../../kernel/event/current_interrupt-2.html">current_interrupt / 2</A>, <A HREF="../../kernel/obsolete/get_timer-2.html">get_timer / 2</A>, <A HREF="../../kernel/opsys/sleep-1.html">sleep / 1</A>, <A HREF="../../kernel/event/set_interrupt_handler-2.html">set_interrupt_handler / 2</A>
</BODY></HTML>
